Matching Nuts and Bolts Optimally∗
نویسنده
چکیده
The nuts and bolts problem is the following : Given a collection of n nuts of distinct sizes and n bolts of distinct sizes such that for each nut there is exactly one matching bolt, find for each nut its corresponding bolt subject to the restriction that we can only compare nuts to bolts. That is we can neither compare nuts to nuts, nor bolts to bolts. This humble restriction on the comparisons appears to make this problem quite difficult to solve. In this paper, we illustrate the existence of an algorithm for solving the nuts and bolts problem that makes O(n lg n) nutand-bolt comparisons. We show the existence of this algorithm by showing the existence of certain expander-based comparator networks. Our algorithm is asymptotically optimal in terms of the number of nut-and-bolt comparisons it does. Another view of this result is that we show the existence of a decision tree with depth O(n lg n) that solves this problem.
منابع مشابه
Matching Nuts and Bolts Faster
The problem of matching nuts and bolts is the following Given a collection of n nuts of distinct sizes and n bolts such that there is a one to one correspondence between the nuts and the bolts nd for each nut its corresponding bolt We can only compare nuts to bolts That is we can neither compare nuts to nuts nor bolts to bolts This humble restriction on the comparisons appears to make this prob...
متن کاملMatching Nuts and Bolts Extended Abstract
We describe a procedure which may be helpful to any disorganized carpenter who has a mixed pile of bolts and nuts and wants to nd the corresponding pairs of bolts and nuts. The procedure uses our (and the carpenter's) ability to construct e ciently highly expanding graphs. The problem considered is given a collection of n bolts of distinct widths and n nuts such that there is a 1-1 corresponden...
متن کاملMatching Nuts and Bolts Noga Alon
We describe a procedure which may be helpful to any disorganized carpenter who has a mixed pile of bolts and nuts and wants to nd the corresponding pairs of bolts and nuts. The procedure uses our (and the carpenter's) ability to construct e ciently highly expanding graphs. The problem considered is given a collection of n bolts of distinct widths and n nuts such that there is a 1-1 corresponden...
متن کاملMatching Nuts and Bolts in O(n log n) Time
Given a set of n nuts of distinct widths and a set of n bolts such that each nut corresponds to a unique bolt of the same width, how should we match every nut with its corresponding bolt by comparing nuts with bolts? (No comparison is allowed between two nuts or two bolts.) The problem can be naturally viewed as a variant of the classic sorting problem as follows. Given two lists of n numbers e...
متن کامل